<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'captcha-form',
        ));
echo $form->errorSummary($model);
$this->endWidget();
?>
<h1>Checkout Belanja Upgrade <a href="<?php echo Yii::app()->baseUrl; ?>/member/ecommerce/upgrade/list">(Kembali ke Keranjang Belanja)</a></h1>
<form name="chcekout" method="post">
    <div class="list">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <th width="10">No.</th>
                <th width="50">Kode</th>
                <th>Produk</th>
                <th width="80">Harga</th>
                <th width="10">Qty</th>
                <th width="100">Total</th>
            </tr>
            <?php
            $hidden_form = '';
            if (is_array($cart)) {
                $no = 1;
                foreach ($cart as $id => $row_cart) {
                    echo '<tr>';
                    echo '<td align="right">' . $no . '.</td>';
                    echo '<td align="center">' . $row_cart['products_code'] . '</td>';
                    echo '<td>' . $row_cart['products_name'] . '</td>';
                    echo '<td align="right">' . number_format($row_cart['products_price']) . '</td>';
                    echo '<td align="right">' . $row_cart['quantity'] . '</td>';
                    echo '<td align="right">' . number_format($row_cart['total']) . '</td>';
                    echo '</tr>';
                    $no++;

                    $hidden_form .= '<input type="hidden" name="order_upgrade[' . $no . ']" value="' . $id . '" />';
                    $hidden_form .= '<input type="hidden" name="products_products_category_id[' . $id . ']" value="' . $row_cart['products_products_category_id'] . '" />';
                    $hidden_form .= '<input type="hidden" name="products_code[' . $id . ']" value="' . $row_cart['products_code'] . '" />';
                    $hidden_form .= '<input type="hidden" name="products_name[' . $id . ']" value="' . $row_cart['products_name'] . '" />';
                    $hidden_form .= '<input type="hidden" name="products_quantity[' . $id . ']" value="' . $row_cart['quantity'] . '" />';
                    $hidden_form .= '<input type="hidden" name="products_price[' . $id . ']" value="' . $row_cart['products_price'] . '" />';
                }
                $hidden_form .= '<input type="hidden" name="total_quantity" value="' . $total_quantity . '" />';
                $hidden_form .= '<input type="hidden" name="total_price" value="' . $total_price . '" />';

                echo '<tr class="title">';
                echo '<td colspan="4" align="right">'.$hidden_form.'<strong>TOTAL</strong></td>';
                echo '<td align="right">' . number_format($total_quantity) . '</td>';
                echo '<td align="right">' . number_format($total_price) . '</td>';
                echo '</tr>';
//                echo '<tr class="title">';
//                echo '<td colspan="6" align="right">';
//                echo '<input type="submit" name="submit" value="Proses Transaksi" class="button" />';
//                echo '</td>';
//                echo '</tr>';
            } else {
                echo '<tr><td colspan="6" align="center">-----====-----</td></tr>';
            }
            ?>
        </table>
    </div>
    <br />
    <div class="add">
        <table cellpadding="0" cellspacing="0">
            <tr class="title">
                <th colspan="2" style="text-align:left;"><strong>DATA PENERIMA</strong></th>
            </tr>
            <tr>
                <th width="150">Nama Penerima</th>
                <td><input type="text" name="recipient_name" value="<?php echo $member->member_name; ?>" size="40" class="text" /></td>
            </tr>
            <tr>
                <th>Alamat Lengkap Pengiriman</th>
                <td><textarea name="recipient_address" cols="50" rows="4"><?php echo $member->member_address; ?></textarea></td>
            </tr>
            <tr>
                <th>No. Telepon Penerima</th>
                <td><input type="text" name="recipient_phone" value="<?php echo $member->member_mobilephone; ?>" size="20" class="text" /></td>
            </tr>
            <tr class="title">
                <th colspan="2" style="text-align:left;"><strong>VALIDASI PIN</strong></th>
            </tr>
            <tr>
                <th width="100">PIN Utama</th>
                <td><input type="password" name="pin" value="" size="10" class="text" /></td>
            </tr>
            <?php if (extension_loaded('gd')): ?>
                <tr class="title">
                    <th colspan="2" style="text-align:left;"><strong>VALIDASI KODE UNIK</strong></th>
                </tr>
                <tr>
                    <th>Kode Unik</th>
                    <td>
                        <div style="float:left; padding-right:10px;"><input type="text" name="captcha_form[verifyCode]" value="" size="10" class="text" /></div>
                        <div style="float:left; padding-top:1px;"><?php $this->widget('CCaptcha'); ?></div>
                        <div style="clear:both;"></div>
                    </td>
                </tr>
            <?php endif; ?>
            <tr>
                <th>&nbsp;</th>
                <td><input type="submit" name="submit" value="Proses Transaksi" class="button" /></td>
            </tr>
        </table>
    </div>
</form>